<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simAddDrawingObject</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1>Regular API function</h1>
<h3 class=subsectionBar><a name="simAddDrawingObject" id="simAddDrawingObject"></a>simAddDrawingObject / sim.addDrawingObject </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Adds a drawing object that will be displayed in the scene. Drawing objects are containers that hold several items of a given type. This can be used for several different applications (simulation of paint, simulation of welding seam, display of 3D objects, etc.). Drawing objects created in a <a href="../simulationScripts.htm">simulation script</a> will be automatically removed at simulation end. See also <a href="simAddDrawingObjectItem.htm">sim.addDrawingObjectItem</a>, <a href="simRemoveDrawingObject.htm">sim.removeDrawingObject</a> and the <a href="../pointClouds.htm">point cloud functionality</a>.</td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simAddDrawingObject(simInt objectType,simFloat size,simFloat duplicateTolerance,simInt parentObjectHandle,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>objectType</strong>: a <a href="../apiConstants.htm#customDrawingObjects">drawing object type combined with attributes</a></div>
<div><strong>size</strong>: size of the item (width of lines or size of points are in pixels, other sizes are in meters</div>
<div><strong>duplicateTolerance</strong>: if different from 0.0, then a call to <a href="simAddDrawingObjectItem.htm">simAddDrawingObjectItem</a> will only add the item if there is no other item within duplicateTolerance distance. Useful to avoid adding a too high density of points, is however not appropriate when using a large number of points (slower operation). Applicable only for single vertex items.<br>
</div>
<div><strong>parentObjectHandle</strong>: handle of the scene object where the drawing items should keep attached to (if the scene object moves, the drawing items will also move), or -1 if the drawing items are relative to the world (fixed)<br>
</div>
<div><strong>maxItemCount</strong>: maximum number of items this object can hold.</div>
<div><strong>ambient_diffuse</strong>: default ambient/diffuse color (pointer to 3 rgb values). Can be nullptr</div>
<div><strong>setToNULL</strong>: not used, set to nullptr</div>
<div><strong>specular</strong>: default specular color (pointer to 3 rgb values). Can be nullptr</div>
<div><strong>emission</strong>: default emissive color (pointer to 3 rgb values). Can be nullptr</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>handle of the drawing object if successful, -1 otherwise</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>int drawingObjectHandle=sim.addDrawingObject(int objectType,float size,float duplicateTolerance,int parentObjectHandle,int maxItemCount,table[3] ambient_diffuse=nil,nil,table[3] specular=nil,table[3] emission=nil)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>Similar to the C-function counterpart</div>
<div></div>
</td> 
</tr> 

<tr class=apiTableTr> 
<td class=remApiTableLeftCParam>
Remote API equiv.
</td> 
<td class=remApiTableRightCParam>
<div>B0-based remote API: <a href="../b0RemoteApi-cpp.htm#simxAddDrawingObject_points">simxAddDrawingObject_points</a>, <a href="../b0RemoteApi-cpp.htm#simxAddDrawingObject_segments">simxAddDrawingObject_segments</a>, <a href="../b0RemoteApi-cpp.htm#simxAddDrawingObject_triangles">simxAddDrawingObject_triangles</a>, <a href="../b0RemoteApi-cpp.htm#simxAddDrawingObject_spheres">simxAddDrawingObject_spheres</a>, <a href="../b0RemoteApi-cpp.htm#simxAddDrawingObject_cubes">simxAddDrawingObject_cubes</a></div>
<div>Legacy remote API: -</div>
</td> 
</tr> 

</table> 


<br>
</td>
</tr>
</table>
</div>
</body>
</html>
